LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;

ENTITY BIN2HEX IS
    PORT (
        bin : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
        hex : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); --DE10 LITE
END BIN2HEX;

ARCHITECTURE behav OF BIN2HEX IS
BEGIN
    PROCESS (bin)
    BEGIN
        CASE BIN IS
            WHEN "0000" => HEX <= "11000000"; --0
            WHEN "0001" => HEX <= "11111001"; --1
            WHEN "0010" => HEX <= "10100100"; --S2
            WHEN "0011" => HEX <= "10110000"; --3
            WHEN "0100" => HEX <= "10011001"; --4
            WHEN "0101" => HEX <= "10010010"; --5
            WHEN "0110" => HEX <= "10000010"; --6
            WHEN "0111" => HEX <= "11111000"; --7
            WHEN "1000" => HEX <= "10000000"; --8
            WHEN "1001" => HEX <= "10010000"; --9
            WHEN "1010" => HEX <= "10001000"; --A
            WHEN "1011" => HEX <= "10000011"; --B
            WHEN "1100" => HEX <= "11000110"; --C
            WHEN "1101" => HEX <= "10100001"; --D
            WHEN "1110" => HEX <= "10000110"; --E
            WHEN "1111" => HEX <= "10001110"; --F
            WHEN OTHERS => HEX <= "11111111"; --all offs
        END CASE;
    END PROCESS;
END behav;